﻿<UserControl x:Class="Kokomo.Environment.Documents.DetailView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
			 xmlns:c="clr-namespace:Kokomo.Controls;assembly=Kokomo.UI"
			 xmlns:env="clr-namespace:Kokomo.Environment;assembly=Kokomo.Environment"
			 xmlns:k="xaml://kokomo/"
			 xmlns:doc="clr-namespace:Kokomo.Environment.Documents"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
	<UserControl.Style>
		<Style TargetType="UserControl">
			<Style.Triggers>
				<DataTrigger Binding="{Binding}" Value="{x:Null}">
					<Setter Property="Visibility" Value="Collapsed"/>
				</DataTrigger>
			</Style.Triggers>
		</Style>
	</UserControl.Style>
	<UserControl.Resources>
		<Style x:Key="SummaryDocumentStyle" TargetType="FlowDocument">
			<Setter Property="FontFamily" Value="Tahoma"/>
			<Setter Property="FontSize" Value="12"/>
		</Style>

		<DataTemplate DataType="{x:Type doc:DetailViewModel}">
			<Border
						Style="{DynamicResource {x:Static env:EditorStyleKeys.SectionBorderStyleKey}}"
						>
				<ContentPresenter
							Content="{Binding Content}"
							ContentTemplateSelector="{x:Static env:AttributedViewTemplateSelector.Default}"
							/>
			</Border>
		</DataTemplate>
	</UserControl.Resources>

	<Grid>
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto"/>
			<RowDefinition Height="6"/>
			<RowDefinition Height="*"/>
		</Grid.RowDefinitions>

		<Border
			Style="{DynamicResource {x:Static env:EditorStyleKeys.SectionBorderStyleKey}}"
			>
			<doc:SummaryView Grid.Row="1" Margin="6" DataContext="{Binding Summary}"/>
		</Border>

		<ContentPresenter
			Grid.Row="2"
			Content="{Binding}"
			ContentTemplateSelector="{x:Static env:AttributedViewTemplateSelector.Default}"
			>
		</ContentPresenter>
	</Grid>
</UserControl>
